﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using CorsatAdminApp.Library.TempTaskClasses;

namespace CorsatAdminApp.Desktop.UserControls
{
    public partial class ucResults : UserControl
    {
        public ucResults()
        {
            InitializeComponent();
        }

        //private void ucResults_Load(object sender, EventArgs e)
        //{
        //    GridVeiwFunction();
        //    CourseTitlesCB.DataSource = _result.GetAllCourses();
        //    CourseTitlesCB.DisplayMember = "ItemName";
        //    CourseTitlesCB.ValueMember = "ItemID";
        //}

        #region private Variable

      
        #endregion

        public IList<Result> AccountResults { get; set; }
        public IList<Item> Items { get; set; }


        private void ucResults_Load(object sender, EventArgs e)
        {
            CbxCourseTitle.DataSource = Items;
            CbxCourseTitle.DisplayMember = "ItemName";
            CbxCourseTitle.ValueMember = "ItemID";

            CbxLevel.DataSource = Items;
            CbxLevel.DisplayMember = "ItemName";
            CbxLevel.ValueMember = "ItemID";
        }

        private void CbxCourseTitle_SelectedIndexChanged(object sender, EventArgs e)
        {
            DGridResults.DataSource = AccountResults;
        }

        private void CbxLevel_SelectedIndexChanged(object sender, EventArgs e)
        {
            DGridResults.DataSource = AccountResults;
        }

        private void BtnLoad_Click(object sender, EventArgs e)
        {
            try
            {
                DGridResults.DataSource = AccountResults;
                BtnLoad.Enabled = false;
                BtnSave.Enabled = true;
            }
            catch (Exception)
            {
                MessageBox.Show(@"Error !");
            }
        }

        private void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {


            }
            catch (Exception)
            {
                MessageBox.Show(@"Please,Select CourseTitle & Level be4 Save ur Data");
            }

        }

        

       
       
    }
}
